package web;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;

import beans.Member;
import service.MemberService;
import serviceimpl.MemberServiceIpmt;

@WebServlet("/RegistServlet")
public class RegistServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	MemberService ms=new MemberServiceIpmt();
	
    public RegistServlet() {
        super();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//		String username=request.getParameter("username");
//		System.out.println(username);
//		String password = request.getParameter("password");
//		System.out.println(password);
//		String nikename = request.getParameter("nikename");
//		System.out.println(nikename);
//		String gendar = request.getParameter("gendar");
//		System.out.println(gendar);
//		String birthday = request.getParameter("birthday");
//		System.out.println(birthday);
//		String height = request.getParameter("height");
//		System.out.println(height);
//		String income = request.getParameter("income");
//		System.out.println(income);
//		String study = request.getParameter("study");
//		System.out.println(study);
//		String wedding = request.getParameter("wedding");
//		System.out.println(wedding);
		Member member=new Member();
		try {
			BeanUtils.populate(member, request.getParameterMap());
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.out.println(member);
		ms.Regist(member);
		response.sendRedirect("/zzLoveProduct/login/login/login.jsp");

		
		
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
